package com.bjpowernode.queue;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 * @ClassName Test1
 * @Description TODO
 * @date 2021/9/16 11:20
 * @Author ZY
 */
public class Test1 {
    public static void main(String[] args) throws IOException {
        Queue queue = new Queue(3);
        Scanner scanner = new Scanner(System.in);
        boolean loop = true;
        while (loop){
            System.out.println("欢迎来到队列体验系统！");
            System.out.println("1--->添加元素");
            System.out.println("2--->取出元素");
            System.out.println("3--->查看队列状态");
            System.out.println("0--->退出系统");
            char flag = scanner.next().charAt(0);
            switch (flag) {
                case '1' :
                    System.out.print("请输入要添加的数字：");
                    queue.add(scanner.nextInt());
                    break;
                case '2':
                    Integer integer = queue.get();
                    if (integer != null){
                        System.out.println(integer);
                    }
                    break;
                case '3':
                    System.out.println(queue);
                    break;
                case '0':
                    loop = false;
                    break;
            }
            System.out.println("++++++++++++++++++++++++++++++++++++++++++++");
        }
        System.out.println("欢迎再次使用！~");
    }
}
